package com.zyf.chapter01.oo;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.logging.Level;

/**
 *  理论五
 *   抽象类特性
 * @author yifeng
 */
public class FileLogger extends Logger {

    private Writer fileWriter;

    public FileLogger(String name, boolean enabled, Level minPermittedLevel, String filepath) throws IOException {
        super(name, enabled, minPermittedLevel);
        this.fileWriter = new FileWriter(filepath);
    }

    @Override
    protected void doLog(Level level, String message) throws IOException {
        // 格式化level 和 message，输出到日志文件
        fileWriter.write("...");
    }
}
